package jse;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class TestReflect {
	public static void main(String[] args) {
		reflect("s");
		reflect(1);
	}
	public static void reflect(Object obj){
		Class cls=obj.getClass();
		System.out.println("类："+cls.getName());
		Field[] fields=cls.getFields();
		for(Field field:fields){
			System.out.println(field.getType()+field.getName());
		}
		Method[] methods=cls.getMethods();
		for(Method method:methods){
			System.out.println(method.getReturnType()+method.getName());
		}
	}
}
